#include "wxGridView.h"

wxGridView::wxGridView(wxWindow *parent, const wxPoints *points) : wxGrid(parent, wxID_ANY)
{
    this->points = points;
    int rows = this->points->count();
    CreateGrid(rows, 3);
    SetColLabelValue(0, "X");
    SetColLabelValue(1, "Y");
    SetColLabelValue(2, "Z");
    EnableScrolling(false, true);
    EnableEditing(false);

    for(int i = 0; i < rows; i++)
    {
        XYZ *point = points->getPoint(i);

        double x = point->x;
        double y = point->y;
        double z = point->z;

        SetCellValue(i, 0, wxString::FromDouble(x));
        SetCellValue(i, 1, wxString::FromDouble(y));
        SetCellValue(i, 2, wxString::FromDouble(z));
    }
}

wxGridView::~wxGridView()
{
    ClearGrid();
}
